package com.neusoft.rental.service.impl;

import com.neusoft.rental.mapper.PlaceMapper;
import com.neusoft.rental.po.Place;
import com.neusoft.rental.service.PlaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PlaceServiceImpl implements PlaceService {

    @Autowired
    private PlaceMapper placeMapper;

    //三种功能，一、根据场地名称模糊搜索场地，二、管理员查询所有场地、三、普通用户所有已发放场地
    @Override
    public List<Place> queryplacebyname(Place place) {
        return placeMapper.queryplacebyname(place);
    }

    //根据id查询场地详情
    @Override
    public Place queryPlacebyid(int placeid) {
        return placeMapper.queryPlacebyid(placeid);
    }

    //两种功能，一是实现了预约成功或者场地归还成功时当前预约人数的变化，二是管理员修改场地信息
    @Override
    public int updatePlace(Place place) {
        return placeMapper.updatePlace(place);
    }

    //管理员增加场地
    @Override
    public int addPlace(Place place) {
        return placeMapper.addPlace(place);
    }

    //管理员根据id删除场地
    @Override
    public int deletePlaceById(int placeid) {
        return placeMapper.deletePlaceById(placeid);
    }
}
